//
//  FLAddView.m
//  FeeLing
//
//  Created by 乔光玉 on 2019/1/10.
//  Copyright © 2019年 大仙儿飘. All rights reserved.
//

#import "FLAddView.h"
@interface FLAddView()

@end
@implementation FLAddView
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self initView];
    }
    return self;
}
-(void)initView{
    self.userInteractionEnabled = YES;
    self.backgroundColor= [UIColor colorWithHexString:@"#2B2D5C"];
    
    UILabel * addlabelone = [[UILabel alloc]init];
    addlabelone.frame = CGRectMake(0, 103*SCREENHEIGHT/667, SCREENWIDTH, 28);
    addlabelone.textAlignment = NSTextAlignmentCenter;
    addlabelone.textColor = [UIColor colorWithHexString:@"#FFFFFF"];
    addlabelone.font = [UIFont fontWithName:@"PingFangSC-Thin" size: 20];
    addlabelone.text = NSLocalizedString(@"addlabelonetext", nil);
   // [self addSubview:addlabelone];
    
    UILabel * addlabeltwo = [[UILabel alloc]init];
    addlabeltwo.frame = CGRectMake(0, addlabelone.bottom, SCREENWIDTH, 28);
    addlabeltwo.textAlignment = NSTextAlignmentCenter;
    addlabeltwo.textColor = [UIColor colorWithHexString:@"#FFFFFF"];
    addlabeltwo.font = [UIFont fontWithName:@"PingFangSC-Thin" size: 20];
    addlabeltwo.text = NSLocalizedString(@"addlabeltwotext", nil);
    //[self addSubview:addlabeltwo];
    
    UIView * line = [[UIView alloc]init];
    line.frame = CGRectMake(SCREENWIDTH/2-40, addlabeltwo.bottom+9*SCREENHEIGHT/667, 80, 1);
    [self addSubview:line];
    
    UIView *videoviewbottom = [[UIView alloc] init];
    videoviewbottom.frame = CGRectMake(SCREENWIDTH/2-26-90,374*SCREENHEIGHT/667,90,90);
    [self addSubview:videoviewbottom];
    
    
    // gradient
    CAGradientLayer *videogl = [CAGradientLayer layer];
    videogl.frame = CGRectMake(0,0,90,90);
    videogl.startPoint = CGPointMake(0.5, 0);
    videogl.endPoint = CGPointMake(0.5, 1);
    videogl.colors = @[(__bridge id)[UIColor colorWithRed:126/255.0 green:139/255.0 blue:248/255.0 alpha:1.0].CGColor, (__bridge id)[UIColor colorWithRed:76/255.0 green:88/255.0 blue:232/255.0 alpha:1.0].CGColor];
    videogl.locations = @[@(0), @(1.0f)];
    videogl.cornerRadius = 45;
    [videoviewbottom.layer insertSublayer:videogl atIndex:0];
    
    UIImageView * videoImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"视频导入"]];
    videoImageView.frame = CGRectMake(25, 16, 40, 40);
    [videoviewbottom addSubview:videoImageView];
    
    UILabel * videoLabel = [[UILabel alloc]init];
    videoLabel.frame = CGRectMake(0,62 , videoviewbottom.width, 16);
    videoLabel.textAlignment = NSTextAlignmentCenter;
    videoLabel.textColor = [UIColor colorWithHexString:@"#FFFFFF"];
    videoLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size: 11];
    videoLabel.text = NSLocalizedString(@"videoLabeltext", nil);
    [videoviewbottom addSubview:videoLabel];
    
    
    
    
    UIView *audioviewbottom = [[UIView alloc] init];
    audioviewbottom.frame = CGRectMake(SCREENWIDTH/2+26,374*SCREENHEIGHT/667,90,90);
    [self addSubview:audioviewbottom];
    
    
    // gradient
    CAGradientLayer *audiogl = [CAGradientLayer layer];
    audiogl.frame = CGRectMake(0,0,90,90);
    audiogl.startPoint = CGPointMake(0.5, 0);
    audiogl.endPoint = CGPointMake(0.5, 1);
    audiogl.colors = @[(__bridge id)[UIColor colorWithRed:126/255.0 green:139/255.0 blue:248/255.0 alpha:1.0].CGColor, (__bridge id)[UIColor colorWithRed:76/255.0 green:88/255.0 blue:232/255.0 alpha:1.0].CGColor];
    audiogl.locations = @[@(0), @(1.0f)];
    audiogl.cornerRadius = 45;
    [audioviewbottom.layer insertSublayer:audiogl atIndex:0];
    
    UIImageView * audioImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"录音"]];
    audioImageView.frame = CGRectMake(25, 16, 40, 40);
    [audioviewbottom addSubview:audioImageView];
    
    UILabel * audioLabel = [[UILabel alloc]init];
    audioLabel.frame = CGRectMake(0,62 , videoviewbottom.width, 16);
    audioLabel.textAlignment = NSTextAlignmentCenter;
    audioLabel.textColor = [UIColor colorWithHexString:@"#FFFFFF"];
    audioLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size: 11];
    audioLabel.text = NSLocalizedString(@"audioLabeltext", nil);
    [audioviewbottom addSubview:audioLabel];
    
    
    
    UIView * video = [[UIView alloc]initWithFrame:CGRectMake(SCREENWIDTH/2-26-90,374*SCREENHEIGHT/667,90,90)];
    video.userInteractionEnabled = YES;
    video.backgroundColor = [UIColor clearColor];
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(videoTapGestureRecognizer:)];
    [video addGestureRecognizer:tap];
    [self addSubview:video];
    
    UIView * audio = [[UIView alloc]initWithFrame:CGRectMake(SCREENWIDTH/2+26,374*SCREENHEIGHT/667,90,90)];
    audio.userInteractionEnabled = YES;
    audio.backgroundColor = [UIColor clearColor];
    UITapGestureRecognizer * tapp = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(audioTapGestureRecognizer:)];
    [audio addGestureRecognizer:tapp];
    [self addSubview:audio];
    
    UIButton * cancel = [UIButton new];
    [cancel setImage:[UIImage imageNamed:@"关闭"] forState:UIControlStateNormal];
    cancel.frame = CGRectMake(SCREENWIDTH/2-19.5, SCREENHEIGHT-15*SCREENHEIGHT/667-39, 39, 39);
    [cancel addTarget:self action:@selector(cancelclcik:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:cancel];
}
-(void)videoTapGestureRecognizer:(UITapGestureRecognizer *)tap{
    
    self.videoBlock(tap);
}
-(void)audioTapGestureRecognizer:(UITapGestureRecognizer *)tap{
    
    self.audioBlock(tap);
}
-(void)cancelclcik:(UIButton *)sender{
    
    
    self.cancelBlock(sender);
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
